
var app = getApp();
var util = app.util;

Component({
    properties: {
        dingding:{
          type: Boolean,
          value: false
        },
        roles: {
            type: String,
            value: 0
        },
        isZhidingka:{
            type: Boolean,
            value: 0
          },
        background: {
            type: String,
            value: "rgba(255, 255, 255, 1)"
        },
        color: {
            type: String,
            value: "rgba(0, 0, 0, 1)"
        },
        titleText: {
            type: String,
            value: "导航栏"
        },
        titleImg: {
            type: String,
            value: ""
        },
        newsIcon: {
            type: String,
            value: ""
        },
        backIcon: {
            type: String,
            value: ""
        },
        homeIcon: {
            type: String,
            value: ""
        },
        fontSize: {
            type: Number,
            value: 16
        },
        iconHeight: {
            type: Number,
            value: 19
        },
        iconWidth: {
            type: Number,
            value: 58
        }
    },
    attached: function() {
        var t = this;
        t.setNavSize(), t.setStyle();
    },
    data: {
    },
    methods: {
        setNavSize: function() {
            var t, e = this, i = wx.getSystemInfoSync(), a = i.statusBarHeight, n = i.screenHeight;
            t = i.system.indexOf("iOS") > -1 ? 44 : 48, e.setData({
                status: a,
                navHeight: t,
                screenHeight: n
            });
        },
        setStyle: function() {
            var t, e, i, a = this;
            t = [ "background:" + a.data.background ].join(";"), e = [ "color:" + a.data.color, "font-size:" + a.data.fontSize + "px" ].join(";"), 
            i = [ "width: " + a.data.iconWidth + "px", "height: " + a.data.iconHeight + "px" ].join(";"), 
            a.setData({
                containerStyle: t,
                textStyle: e,
                iconStyle: i
            });
        },
        choiseTing: function() {
            this.triggerEvent("choiseting", "");
        },
        news: function() {
            wx.navigateTo({
                url: "../../wheat/pages/xiaoxi/xiaoxi"
            })
            var t = wx.getStorageSync("userinfo").roles + "";              
        },
        //发放置顶卡
        gozhidingka:function(){

            var hall_info =  wx.getStorageSync('hall_info')
            var flag = util.checkAuditTime(hall_info["send_start"],hall_info["send_end"]);
            if(!flag){
                wx.showToast({
                  title: '置顶卡发放时间已过',
                  icon:'none'
                })
                return;
            }
            wx.removeStorageSync("hostList")
            wx.removeStorageSync("userList")
            wx.navigateTo({
                url: "../../wheat/pages/main_zhidingka/main_zhidingka"
            })
        },
        back: function() {
            wx.navigateBack({
                delta: 1
            }), this.triggerEvent("back", {
                back: 1
            });
        },
        home: function() {
            this.triggerEvent("home", {});
        }
    }
});